Imports app = AppQfinityExport
Imports System.Threading
Imports System.Security.Principal
Imports System.Xml
Imports System.IO



Public Class QfinitiExportService
    Private qapp As New Thread(New ThreadStart(AddressOf app.Main))
    Private dirInstall As String



  
    Protected Overrides Sub OnStart(ByVal args() As String)
        Try
            dirInfoLog()
            Dim trcLog As TextWriterTraceListener = New TextWriterTraceListener("")

            'inicializar()
            'log("Iniciando Servicio QfinitiExport...")

            'qapp.IsBackground = False
            qapp.Start()
        Catch ex As Exception
            log(ex.Message)
        End Try
        

    End Sub


    Protected Overrides Sub OnStop()
        Try
            dirInfoLog()
            'log("Deteniendo Servicio QfinitiExport...")

            qapp.Abort()

        Catch ex As Exception
            log(ex.Message)
        End Try
    End Sub



    Sub dirInfoLog()

        Try
            dirInstall = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\Anew\AppQfinitiExport", "dirInstall", Nothing).ToString.Trim
        Catch ex As Exception
            Try
                dirInstall = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\Wow6432Node\Anew\AppQfinitiExport", "dirInstall", Nothing).ToString.Trim
            Catch ex2 As Exception
                Trace.WriteLine(DateTime.Now.ToString() & " " & ex2.Message)
            End Try
        End Try


    End Sub


End Class
